﻿Public Class Venta
    Implements IDisposable
    Dim szSQL As String
    Public _RutContratante As Integer
    Public _DVContratante As String
    Public _FechaNacimientoAsegurado As String
    Public _iAnno As Integer
    Public _NombreContratante As String
    Public _IDSeguro As Integer
    Public _NroCarga As Integer
    Public _CodTipoproducto As String

    Public _Rut_Asegurado As String
    Public _DVRut_Asegurado As String
    Public _RutCarga1 As String
    Public _DV_RutCarga1 As String
    Public _Nombre1 As String
    Public _Ape_Mat1 As String
    Public _Ape_Pat1 As String
    Public _FechaNacimientoCarga1 As String
    Public _ID_Parentesco1 As String
    Public _RutCarga2 As String
    Public _DV_RutCarga2 As String
    Public _Nombre2 As String
    Public _Ape_Mat2 As String
    Public _Ape_Pat2 As String
    Public _FechaNacimientoCarga2 As String
    Public _ID_Parentesco2 As String
    Public _RutCarga3 As String
    Public _DV_RutCarga3 As String
    Public _Nombre3 As String
    Public _Ape_Mat3 As String
    Public _Ape_Pat3 As String
    Public _FechaNacimientoCarga3 As String
    Public _ID_Parentesco3 As String
    Public _RutCarga4 As String
    Public _DV_RutCarga4 As String
    Public _Nombre4 As String
    Public _Ape_Mat4 As String
    Public _Ape_Pat4 As String
    Public _FechaNacimientoCarga4 As String
    Public _ID_Parentesco4 As String
    Public _RutCarga5 As String
    Public _DV_RutCarga5 As String
    Public _Nombre5 As String
    Public _Ape_Mat5 As String
    Public _Ape_Pat5 As String
    Public _FechaNacimientoCarga5 As String
    Public _ID_Parentesco5 As String
    Public _RutCarga6 As String
    Public _DV_RutCarga6 As String
    Public _Nombre6 As String
    Public _Ape_Mat6 As String
    Public _Ape_Pat6 As String
    Public _FechaNacimientoCarga6 As String
    Public _ID_Parentesco6 As String
    Public _FolioSalud As String


    Public Sub Get_Bancos(ByVal rp As NetResponse.MsSqlServer)
        Dim exec As New DotNetDAL.SqlServerTransaccion()
        rp.StoredProcedure = "SP_GetBancos"

        exec.Executedataset(rp)

        exec.Dispose()

    End Sub

    Public Sub Put_FolioSalud(ByVal rp As NetResponse.MsSqlServer)
        Dim exec As New DotNetDAL.SqlServerTransaccion()

        rp.StoredProcedure = "sp_Put_FolioSalud"

        rp.AddParametro(_IDSeguro)
        rp.AddParametro(_FolioSalud)

        exec.ExecuteNonQuery(rp)

        exec.Commit()

        exec.Dispose()

    End Sub

    Public Sub Put_VentaConfirmada(ByVal rp As NetResponse.MsSqlServer)
        Dim exec As New DotNetDAL.SqlServerTransaccion()

        rp.StoredProcedure = "sp_Put_DatosVentaConfirmado"

        rp.AddParametro(_IDSeguro)

        exec.ExecuteNonQuery(rp)

        exec.Commit()

        exec.Dispose()

    End Sub

    Public Sub Put_Carga(ByVal rp As NetResponse.MsSqlServer)
        Dim exec As New DotNetDAL.SqlServerTransaccion()
        rp.StoredProcedure = "Sp_GrabaCargas"

        rp.AddParametro(_IDSeguro)



        rp.AddParametro(_Rut_Asegurado)
        rp.AddParametro(_DVRut_Asegurado)
        rp.AddParametro(_RutCarga1)
        rp.AddParametro(_DV_RutCarga1)
        rp.AddParametro(_Nombre1)
        rp.AddParametro(_Ape_Mat1)
        rp.AddParametro(_Ape_Pat1)
        rp.AddParametro(_FechaNacimientoCarga1)
        rp.AddParametro(_ID_Parentesco1)
        rp.AddParametro(_RutCarga2)
        rp.AddParametro(_DV_RutCarga2)
        rp.AddParametro(_Nombre2)
        rp.AddParametro(_Ape_Mat2)
        rp.AddParametro(_Ape_Pat2)
        rp.AddParametro(_FechaNacimientoCarga2)
        rp.AddParametro(_ID_Parentesco2)
        rp.AddParametro(_RutCarga3)
        rp.AddParametro(_DV_RutCarga3)
        rp.AddParametro(_Nombre3)
        rp.AddParametro(_Ape_Mat3)
        rp.AddParametro(_Ape_Pat3)
        rp.AddParametro(_FechaNacimientoCarga3)
        rp.AddParametro(_ID_Parentesco3)
        rp.AddParametro(_RutCarga4)
        rp.AddParametro(_DV_RutCarga4)
        rp.AddParametro(_Nombre4)
        rp.AddParametro(_Ape_Mat4)
        rp.AddParametro(_Ape_Pat4)
        rp.AddParametro(_FechaNacimientoCarga4)
        rp.AddParametro(_ID_Parentesco4)
        rp.AddParametro(_RutCarga5)
        rp.AddParametro(_DV_RutCarga5)
        rp.AddParametro(_Nombre5)
        rp.AddParametro(_Ape_Mat5)
        rp.AddParametro(_Ape_Pat5)
        rp.AddParametro(_FechaNacimientoCarga5)
        rp.AddParametro(_ID_Parentesco5)
        rp.AddParametro(_RutCarga6)
        rp.AddParametro(_DV_RutCarga6)
        rp.AddParametro(_Nombre6)
        rp.AddParametro(_Ape_Mat6)
        rp.AddParametro(_Ape_Pat6)
        rp.AddParametro(_FechaNacimientoCarga6)
        rp.AddParametro(_ID_Parentesco6)


        exec.ExecuteNonQuery(rp)
        exec.Commit()

        exec.Dispose()

    End Sub


    Public Sub Get_Tipoproducto(ByVal rp As NetResponse.MsSqlServer)
        Dim exec As New DotNetDAL.SqlServerTransaccion()
        rp.Query = "Select DescripcionProducto from Tbl_TipoProducto  Where CodigoProducto = '" & _CodTipoproducto & "'"

        exec.Executedataset(rp, rp.Query)
        exec.Dispose()
    End Sub

#Region " IDisposable Support "

    Private disposedValue As Boolean = False        ' To detect redundant calls


    Protected Overridable Sub Dispose(ByVal disposing As Boolean)
        If Not Me.disposedValue Then
            If disposing Then
                ' TODO: free unmanaged resources when explicitly called
            End If

            ' TODO: free shared unmanaged resources
        End If
        Me.disposedValue = True
    End Sub

    ' This code added by Visual Basic to correctly implement the disposable pattern.
    Public Sub Dispose() Implements IDisposable.Dispose
        ' Do not change this code.  Put cleanup code in Dispose(ByVal disposing As Boolean) above.
        Dispose(True)
        GC.SuppressFinalize(Me)
    End Sub
#End Region
End Class
